home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr49 / actlib11.zip / TVTOOLS.ZIP / TVTOOLS.DOC < prev    next >
Text File  |  1993-03-02  |  11KB  |  298 lines

  1. /***
  2.     Module      :   TVTOOLS
  3.  
  4.     Description :   Various tools and addings for TV 
  5.  
  6.     Remark      :   This library calls a lot of general functions 
  7.                     from the 'general' libraries (STRINGS.LIB, TOOLS.LIB,...).
  8.                     This mean that you have to include the related include 
  9.                     files and to link (some of) the other libraries with your 
  10.                     application.
  11.  
  12.  
  13.  
  14.   New operators:    TMenuItem  = TMenuItem + TMenuItem
  15.   =============     TMenuItem += TMenuItem
  16.                     TSItem  = TSItem + TSItem
  17.                     TSItem += TSItem
  18.                     TSubMenu += TSubMenu
  19.                     TSubMenu += TMenuItem
  20.                     TStatusDef += TStatusDef
  21.                     TStatusDef += TStatusItem
  22.  
  23.  
  24.   General List:
  25.   ============
  26.  
  27.   TGenCollection:  Same as TStringCollection
  28.                       TGenCollection( ccIndex = 0, ccIndex = 0 );
  29.  
  30.        but with two output functions:
  31.            char *getData( ccIndex );  // to return the data
  32.            char *getText( ccIndex );  // to display text in a viewer
  33.        By default, getData() calls getText().
  34.  
  35.        These functions have to be used in place of TStringCollection ones
  36.        and can be overloaded:
  37.            ccIndex indexOf( char *item );       // data index
  38.            ccIndex indexOfText( char *item );   // text index
  39.            void *firstThat( ccTestFunc Test, void *arg );     // search
  40.            void *firstTextThat( ccTestFunc Test, void *arg ); // search
  41.            int getCount();                // returns number of items
  42.            int getTextLength();           // returns maximum length of text
  43.            int compare( void *, void * ); // function to compare to items
  44.        All these virtual functions are designed to work as is with
  45.        TStringCollection lists.
  46.        The functions you need to overload to use another list mechanism are:
  47.            getData(), getText(), getCount()
  48.        the other ones use these three ones.
  49.        default compare() is case-insensitive
  50.            (also éàÅ,... are treated as normal letters).
  51.               
  52.  
  53.   ComboBox:
  54.   ========
  55.  
  56.   TComboBox:  Pop-up box with a list viewer
  57.               Must be linked with a TInputLine (or TStaticInputLine)
  58.               ans a TGenCollection.
  59.  
  60.               When pressing characters, the first list item matching these
  61.               characters is focused. If a non matching character is pressed,
  62.               a buzzer sound is output. 
  63.  
  64.               Enter or double-click is used to select an item.
  65.               The corresponding data will so be given to the TInputLine.
  66.  
  67.               TComboBox( const TRect&, TInputLine *, TGenCollection * );
  68.               TComboBox( TInputLine *, TGenCollection * ); // Right of line
  69.  
  70.  
  71.   New Input fields:
  72.   ================
  73.  
  74.   TInput1Line( x, y, len )
  75.  
  76.   T1StaticText( x, y, string ): same as TStaticText
  77.  
  78.   TStaticTextf( const TRect& bounds, const char *fmt, ... )
  79.   TStaticTextf( const ushort x, const ushort y, const char *fmt, ... )
  80.    same as TStaticText but allows same syntax as printf()
  81.  
  82.   T1Label( x, y, string, link )
  83.  
  84.  
  85.   TInputKey:    Same as TInputLine, except invalid if empty
  86.                 TInputKey( const TRect&, int len );
  87.                 TInputKey( int x, int y, int len );
  88.  
  89.  
  90.   TInputPasswd: Same as TInputLine, but display only '*'
  91.                 TInputPasswd( const TRect&, int len );
  92.                 TInputPasswd( int x, int y, int len );
  93.                                      
  94.  
  95.   TInputRegExp: Same as TInputLine, but filter input to be in a 'set'
  96.                 and check result to match the regular expression 'regexp'.
  97.                 If UPPER or LOWER is given as last parameter, all characters
  98.                 are translate into upper/lowercase (also éàÅ,...).
  99.  
  100.                 If an invalid character is pressed, a buzzer sound is output.
  101.                 If input does not match the regular expression, a messageBox
  102.                 is output at valid() time. This message may be replaced
  103.                 or disabled (0).
  104.                 char *invMsg = " \n\03Invalid entry !";
  105.  
  106.                 'set' and 'regexp' comply with UNIX-grep regular expressions;
  107.                 ex: set = "0-9a-z+-*/" or "^0-9"
  108.                     regexp = "[0-9]*.[a-zA-Z]*..*"
  109.                 'set' and 'regexp' can be nul (0 or not given).
  110.  
  111.                 TInputRegExp( const TRect&, int len [, char *set [, char *regexp [, UPPER/LOWER]]] );
  112.                 TInputRegExp( int x, int y, int len [, char *set [, char *regexp [, UPPER/LOWER]]] );
  113.  
  114.  
  115.   TInputInt:    Accepts only valid numeric input (int) between Min and Max
  116.                 If a wrong character is pressed, a buzzer sound is output.
  117.                 TInputInt( const TRect&, int len = 7, int min = -MAXINT, int max = MAXINT );
  118.                 TInputInt( int x, int y , int len = 7, int min = -MAXINT, int max = MAXINT );
  119.  
  120.  
  121.   TInputLong:   Accepts only valid numeric input (long) between Min and Max
  122.                 If a wrong character is pressed, a buzzer sound is output.
  123.                 TInputLong( const TRect&, int len = 12, long min = -MAXLONG, long max = MAXLONG );
  124.                 TInputLong( int x, int y , int len = 12, long min = -MAXLONG, long max = MAXLONG );
  125.  
  126.  
  127.   TInputDouble: Accepts only valid numeric input between Min and Max
  128.                 If a wrong character is pressed, a buzzer sound is output.
  129.                 TInputDouble( const TRect&, int len = 15, double min = -MAXDOUBLE, double max = MAXDOUBLE );
  130.                 TInputDouble( int x, int y , int len = 15, double min = -MAXDOUBLE, double max = MAXDOUBLE );
  131.  
  132.  
  133.   TInputHexa:   Accepts only valid hexadecimal string input
  134.                 If a wrong character is pressed, a buzzer sound is output.
  135.                 TInputHexa( const TRect&, int len );
  136.                 TInputHexa( int x, int y , int len );
  137.  
  138.  
  139.   TInputDate:   Accepts only valid date input
  140.                 If a wrong character is pressed, a buzzer sound is output.
  141.                 TInputDate( const TRect& );
  142.                 TInputDate( int x, int y );
  143.  
  144.  
  145.   TInputCalcul: Accepts a calculation string
  146.                 If a wrong character is pressed, a buzzer sound is output.
  147.                 TInputCalcul( const TRect&, int len );
  148.                 TInputCalcul( int x, int y, int len );
  149.  
  150.  
  151.   TStaticInputLine:
  152.                 Same as TInputLine, but input must match a TGenCollection list.
  153.  
  154.                 When pressing characters, the first list item matching these
  155.                 characters is displayed. If a non matching character is pressed,
  156.                 a buzzer sound is output.
  157.                 The left and right arrows are used to cycle through items,
  158.                 Home & End to go to first & last item
  159.                 (and the matching buffer is reset).
  160.  
  161.                 TStaticInputLine( TRect&, int len, TGenCollection *list );
  162.                 TStaticInputLine( int x, int y, int len, TGenCollection *list );
  163.  
  164.  
  165.   New InputBox:
  166.   ============
  167.  
  168.   ushort inputPasswdBox( const char *Title, const char *aLabel, char *s, uchar limit );
  169.   ushort inputPasswdBoxRect( const TRect &bounds,
  170.                              const char *Title,
  171.                              const char *aLabel,
  172.                              char *s,
  173.                              uchar limit );
  174.  
  175.  
  176.   Misc:
  177.   ====
  178.  
  179.   ushort execDialog( TWindow *d, void *data );
  180.  
  181.         Execute a dialog box and returns entered values.
  182.         Fields are pre-loaded with data values.
  183.         If data is NULL, nothing is pre-loaded nor returned.
  184.         If the dialog is cancelled, data is not modified.
  185.         Dialog is destroyed before exiting.
  186.         Return:  command (cmCancel, cmYes,...)
  187.  
  188.  
  189.   void putCommand( ushort What, ushort Command );
  190.  
  191.         Put an event containing {What, Command}
  192.  
  193.  
  194.   appSystem( command );
  195.  
  196.         Suspend critical error handler,
  197.         clears screen,
  198.         perform a system call,
  199.         resume critical error handler,
  200.         redraws screen.
  201.  
  202.  
  203.   StatusBox:
  204.   ---------
  205.  
  206.   void StatusBox( char *message );
  207.   void StatusBoxf( char *format-string, ... );
  208.  
  209.         Puts a dialog box on screen to tell the user what the program is
  210.         doing while some long calculation is being done.
  211.         If a StatusBox is already on the screen it will be removed before
  212.         displaying the new StatusBox.
  213.         Strings are limited to 255 characters (like TStaticText).
  214.  
  215.   void RemoveStatusBox( void );
  216.  
  217.         Remove a StatusBox (if one is displayed).
  218.  
  219.  
  220.   Standard Buttons:
  221.   ----------------
  222.  
  223.   void OKCancelButtons( TWindow *window );
  224.  
  225.        Insert a OK and a Cancel button in a window.
  226.        Insertion in the middle of the bottom of the window.
  227.        OK button is default one.
  228.  
  229.  
  230.   void YesNoCancelButtons( TWindow *window );
  231.  
  232.        Insert a Yes and a No button in a window.
  233.        Insertion in the middle of the bottom of the window.
  234.        Yes button is default one.
  235.  
  236.                   
  237.   TFileWindow::TFileWindow( const char *fileName );
  238.  
  239.         Open a file viewer Window.
  240.  
  241.  
  242.  
  243.   Gadgets:
  244.   =======
  245.                    
  246.   Clock:    Display a clock on screen
  247.  
  248.             TClockView::TClockView( TRect& r );
  249.                r is optional (default is upper right corner).
  250.             TClockView::update();     must be called in 'idle()'.
  251.  
  252.  
  253.   Heap viewer:    Display the heap size on screen 
  254.                   and check for heap correctness.
  255.  
  256.                   THeapView::THeapView( TRect& r );
  257.                      r is optional (default is lower right corner).
  258.                   THeapView::update();      must be called in 'idle()'.
  259.  
  260.                   If an error occurs in the heap, a messageBox display
  261.                   an error message and ask if you want to display the
  262.                   message again (that means each time it is checked
  263.                   before it is solved - if it is).
  264.  
  265.  
  266.   DeskTop Calendar:      TCalendarView( TRect & r );
  267.                             r is optional 
  268.                          TCalendarView( StreamableInit );
  269.  
  270.  
  271.   DeskTop Calculator:    TCalcDisplay( TRect& r );
  272.                             r is optional
  273.                          TCalcDisplay( StreamableInit );
  274.  
  275.  
  276.                            
  277.   DeskTop ASCII table:   TAsciiChart( TRect& r );
  278.                             r is optional
  279.                          TAsciiChart( StreamableInit );
  280.  
  281.  
  282.   Other:
  283.   =====
  284.  
  285.  ushort formatFloppy( int floppy );
  286.  
  287.    Format a  floppy if needed.
  288.    - Calls the DOS command FORMAT x: [/T:nn /N:nn] /V:""
  289.    - A check is performed after the format.
  290.    - If DOS version >= 4.0 use the /AUTOTEST switch
  291.      (undocumented) to skip prompt.
  292.    - If DOS version >= 5.0 use the /U switch to speed up format.
  293.  
  294.    Parameters :    in    int  floppy ( 0 = A:, 1 = B: )
  295.  
  296.    Return     :    cmOK or cmCancel
  297.  
  298. ***/